home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 2: CDPD 1
/
Almathera Ten on Ten - Disc 2: CDPD 1.iso
/
pd
/
176-200
/
191
/
blk
/
listmac.h
< prev
next >
Wrap
C/C++ Source or Header
|
1995-03-13
|
926b
|
26 lines
/* My MinNode definitions, basically, but with names
* that I like better for C applications
*/
struct Nod {
struct Nod *next,*prev;
};
struct Lst {
struct Nod *head,*tail,*tailprev;
};
/* some macros for dealing with Exec-like lists
* HEAD(lst) struct Lst *lst: gives first node
* TAIL(lst) struct Lst *lst: gives last node
* NEXT(nod) struct Nod *nod: gives next element
* PREV(nod) struct Nod *nod: gives previous element
* TEST(nod) struct Nod *nod: is non-zero for valid nodes
* OFF1(nod) struct Nod *nod: offsets backward one node
*/
#define HEAD(lst) (void *)(((struct Lst*)(lst))->head)
#define TAIL(lst) (void *)(((struct Lst*)(lst))->tailprev)
#define NEXT(nod) (void *)(((struct Nod *)(nod))->next)
#define PREV(nod) (void *)(((struct Nod *)(nod))->prev)
#define TEST(nod) NEXT(nod)
#define OFF1(nod) (void *)((char *)(nod)-sizeof(struct Nod))